<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="css/style.css" type="text/css">
		<script type="text/javascript" src="js/index.js"></script>
		<title>412宿舍信息登录系统</title>
	</head>
	<body>
		<table>
			<tr>
				<td>人员名称：</td>
				<td>
					<input type="text" name="name">
				</td>
			</tr>
			<tr>
				<td>年龄：</td>
				<td>
					<input type="text" name="age">
				</td>
			</tr>
			<tr>
				<td>出生年份：</td>
				<td>
					<input type="text" name="result">
				</td>
			</tr>
			<tr>
				<td>出生地：</td>
				<td>
					<input type="text" name="txz">
				</td>
			</tr>
			<tr>
				<td colspan="10">
					<button onclick="insert()">添加</button>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
			function insert(){
				let name = document.getElementsByName("name")[0].value;
				let age = document.getElementsByName("age")[0].value;
				let result = document.getElementsByName("result")[0].value;
				let txz = document.getElementsByName("txz")[0].value;
				let ajax = getAjax();
				ajax.open("POST","./server/insert_server.php",false);
				ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset = UTF-8");
				ajax.send("name=" + name + "&age=" + age + "&result=" + result + "&txz=" + txz );
				alert(ajax.responseText);
				window.location.href = "index.php";
			}
		</script>
	</body>
</html>
